package com.yzt.sys.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.yzt.base.utils.RequestUtil;

@Controller
@RequestMapping("sys")
public class SysBaseController {

	@GetMapping("/menu")
	public String menu() {
		return "sys/menu/menu";
	}

	@GetMapping("/menuAdd")
	public String menuAdd(HttpServletRequest request) {
		return "sys/menu/menuAdd";
	}

	@GetMapping("/menuEdit")
	public String menuEdit(HttpServletRequest request) {
		RequestUtil.setParameterMap(request, RequestUtil.getParameterMap(request));
		return "sys/menu/menuEdit";
	}

	@GetMapping("/role")
	public String rolePage() {
		return "sys/role/role";
	}

	@GetMapping("/roleModify")
	public String roleModify(HttpServletRequest request) {
		Map<String, Object> params = RequestUtil.getParameterMap(request);
		if (params.size() > 0) {
			RequestUtil.setParameterMap(request, params);
			return "sys/role/roleEdit";
		}
		return "sys/role/roleAdd";
	}

	@GetMapping("/roleMenu")
	public String roleMenuPage(HttpServletRequest request) {
		RequestUtil.setParameterMap(request, RequestUtil.getParameterMap(request));
		return "sys/role/role_menu";
	}

	@RequestMapping("permission")
	public String permission() {
		return "sys/permission/permission";
	}

	@RequestMapping("permissionAdd")
	public String permissionAdd() {
		return "sys/permission/permissionAdd";
	}

	@RequestMapping("permissionEdit")
	public String permissionEdit(HttpServletRequest request) {
		RequestUtil.setParameterMap(request, RequestUtil.getParameterMap(request));
		return "sys/permission/permissionEdit";
	}

	@RequestMapping("role_permission")
	public String rolePermission(HttpServletRequest request) {
		RequestUtil.setParameterMap(request, RequestUtil.getParameterMap(request));
		return "sys/role/role_permission";
	}

	@GetMapping("user")
	public String user() {
		return "sys/user/user";
	}

	@GetMapping("userAdd")
	public String userAdd() {
		return "sys/user/userAdd";
	}

	@GetMapping("userEdit")
	public String userEdit(HttpServletRequest request) {
		RequestUtil.setParameterMap(request, RequestUtil.getParameterMap(request));
		return "sys/user/userEdit";
	}

	@GetMapping("user_role")
	public String user_role(HttpServletRequest request) {
		RequestUtil.setParameterMap(request, RequestUtil.getParameterMap(request));
		return "sys/user/user_role";
	}
}
